//
// main.c
// Intersections
//
// Created by Ian Beardsley on 1/7/25.
//
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[]) {
float R_p, M_p, R_s, M_s, L_s, h_s, t_c, M_m, rho_m, rho_p, PlanetDay,
V_p,StarRadius, PlanetRadius, PlanetMass, StarLuminosity, PlanetOrbit,
StarMass, r_p, T_p, p, L_p, KE_p, v_p, Root, T_m,Tmoon, C_m;
float G=6.674E-11, hbarstar, PDCT,Tsquared,T,PlanetYear;
float Mcubed, r_m, root, R_m, V_m, MoonDensity, part1, part2, part3,v_m,
KE_m;
int i;
printf ("What is the radius of the star in solar radii? ");
scanf ("%f", &StarRadius);
printf ("What is the mass of the star in solar masses? ");
scanf ("%f", &StarMass);
printf ("What is the luminosity of the star in solar luminosities? ");
scanf ("%f", &StarLuminosity);
PlanetOrbit=sqrt(StarLuminosity);
r_p=PlanetOrbit*1.496E11;
M_s=1.9891E30*StarMass;
Tsquared=((4*3.14159*3.14159)/(G*M_s))*r_p*r_p*r_p;
T=sqrt(Tsquared);
PlanetYear=T/31557600;
printf("Do you want us to compute the planet radius, 1=yes, 0=no? ");
scanf("%i", &i);
R_s=6.9364E8*StarRadius;
if (i==1)
{
R_s=6.9364E8*StarRadius;
R_p=2*(R_s*R_s)/r_p;
}
else
{
printf("What is the planet radius in Earth radii?: ");
scanf("%f", &PlanetRadius);
R_p=PlanetRadius*6.378E6;
}
printf("What is the mass of the planet in Earth masses? ");
scanf("%f", &PlanetMass);
M_p=PlanetMass*5.972E24;
printf ("What is the planet day in Earth days? ");
scanf ("%f", &PlanetDay);